using System;
using System.IO;
using System.Runtime.Serialization.Formatters.Soap;

namespace DreamPark
{
	[Serializable]
	public class Trace
	{
		private Vehicule vehicule;
		private string dateEntree;
		private string dateSortie;
		private Acces acces;
		
		public Vehicule Vehicule {
			get { return vehicule; }
			set { vehicule = value; }
		}
		
		public string DateEntree {
			get { return dateEntree; }
			set { dateEntree = value; }
		}
		
		public string DateSortie {
			get { return dateSortie; }
			set { dateSortie = value; }
		}
		
		public Acces Acces {
			get { return acces; }
			set { acces = value; }
		}
		
		public Trace (Vehicule vehicule, string dateEntree, Acces acces) {
			this.acces = acces;
			this.dateEntree = dateEntree;
			this.vehicule = vehicule;
		}

		public static void sauvegarde(string nomFichier, Trace trace) { 
		    FileStream fileStream = new FileStream(nomFichier, FileMode.Append);
		    SoapFormatter soapFormatter = new SoapFormatter();
		    soapFormatter.Serialize(fileStream, trace);
		    fileStream.Close();
		}
	}		
}